<?php
 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Class Muser extends MY_Model
{
    public function __construct()
    {
        parent::__construct();
    }

	public function loginUser()
    {
        $uname = $this->getParamString('username');
        $upass = $this->getParamString('password');
        $pass_encode = md5(md5($uname).md5($upass));
        $sql = $this->db->query("SELECT * FROM user WHERE username = '".strtolower($uname)."' AND pword = '".$pass_encode."' ");
        if($sql->num_rows() > 0)
        {
            $data_ = $sql->row();
            $data_->password = null;
            return (object)array('status' => 200, 'content' => $this->getInfoUser($data_->id), 'description' => 'Đăng nhập thành công.');
        }else{
            return (object)array('status' => 201, 'description' => 'Đăng nhập thất bại.');
        }
    }
	
}
